package com.cloudjan.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class ApplicationConfig {

    @Bean
    @LoadBalanced//开启restTmplate负载均衡，默认轮训
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    //用于自定义的负载均衡算法时使用
    @Bean
    public RestTemplate myRestTemplate(){
        return new RestTemplate();
    }
}
